<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>订单客户信息</title>
<link rel="stylesheet" href="${basepath}/css/pm.css" type="text/css">
</head>
<body>
	<div id="guestdiv">
		<form action="${basepath}/order/create/finish.htm" method="post" name="guestform" id="guestform">
			<fieldset>
				<legend>客户基本信息</legend>
				<ul>
					<li>
						<label>客户名称: </label>
						<input type="text" name="guestinfo.guestName" id="guestName" />
						<div id="guestNameTip"></div>
					</li>				
					<li>
						<label>电子邮件:</label>
						<input type="text" name="guestinfo.guestEmail" />
						<div id="guestEmailTip"></div>
					</li>
					<li>
						<label>联系电话:</label>
						<input type="text" name="guestinfo.guestPhone" />
						<div id="guestPhoneTip"></div>
					</li>
					<li>
						<label>地址:</label>
						<select id="province" name="guestinfo.province.id">
						</select>省&nbsp;&nbsp;
						<select id="city" name="guestinfo.city.id">
						</select>市&nbsp;&nbsp;
						<select id="district" name="guestinfo.district.id">
						</select>区&nbsp;&nbsp;
						
						<input type="text" name="guestinfo.guestAddr" />
						<div id="guestAddrTip"></div>
					</li>
					<li>
						<label>性别:</label>
						<select name="guestinfo.guestSex" >
							<option value="0">女</option>
							<option value="1">男</option>
						</select>
						<div id="sexTip"></div>
					</li>			
					<li>
						<label>客户备注: </label>
						<textarea rows="8" cols="30" name="guestinfo.remark" id="remark" ></textarea>
						<div id="remarkTip"></div>
					</li>				
					<li>
						<input type="submit" value="确认提交订单" />
						<input type="button" value="上一步" onclick="javascript: self.location.href='${basepath}/order/product/create.htm';"/>
						<input type="button" value="取消" onclick="javascript: self.location.href='${basepath}/order/create/cancel.htm';"/>
					</li>				
				</ul>
		</form>
	</div>
</body>
<script type="text/javascript" src="${basepath}/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function(){

	<#--初始化地址-->
	function bindAddrData(data,obj){
		obj.find("option[value!='-1']").remove();
		for(var i=0;i<data.length;i++){
			obj.append($('<option value="'+data[i].id+'" code="'+data[i].code+'">'+data[i].name+'</option>'));
		}
	}
	function obtainDistrict(code){
		$.get("${basepath}/addr/district.htm",{cityCode:code},function(data){
			bindAddrData(data,$("#district"));
		},"json");
	}
	$.get("${basepath}/addr/province.htm",function(data){
		bindAddrData(data,$("#province"));
		$("#province").change(function(evt){
			$.get("${basepath}/addr/city.htm",{provinceCode:$("#province option:selected").attr("code")},function(data){
				bindAddrData(data,$("#city"));
				obtainDistrict($("#city option:selected").attr("code"));
				$("#city").change(function(evt){
					obtainDistrict($("#city option:selected").attr("code"));
				});
			},"json");
		});
		$.get("${basepath}/addr/city.htm",{"provinceCode":$("#province option:selected").attr("code")},function(data){
			bindAddrData(data,$("#city"));
			obtainDistrict($("#city option:selected").attr("code"));
		},"json");
	},"json");

});
</script>
</html>